<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <!-- 插值绑定 -->
        <p>{{name}}</p>
        <!-- 指令 -->
        <p k-text="name"></p>
        <p>{{age}}</p>
        <p>{{dobuleAge}}</p>
        <!-- 双向绑定 -->
        <input type="text" k-module="name">
        <!-- 事件的处理 -->
        <button @click="changename">呵呵</button>
        <!-- html的解析 -->
        <p k-html="html"></p>
    </div>
    <script src="./compile.js"></script>
    <script src="./myvue.js"></script>
    <script>
        const myVue = new Myvue({
            el: '#app',
            data: {
                name: 'i am test',
                age: 12,
                html: "<button>按钮</button>"
            },
            created(){
                console.log('started now ==')
                setTimeout(()=>{
                    this.name = '我是测试内容'
                    this.$data.name = 'ssss'
                },1000)
            },
            methods: {
                changename(){
                    this.name = 'changed name'
                    this.age = 99
                }
            }
        })
    </script>
    <script>
        // const obj = {}
        // Object.defineProperty(obj, 'name' , {
        //     get(){
        //         return document.getElementById('name').innerHTML
        //     },
        //     set(newval){
        //         console.log(newval)
        //         document.getElementById('name').innerHTML = newval
        //     }
        // })
        // obj.name = 'Tom'
    </script>
</body>
</html>